% TEST_ID: LANG-EXPAND-0105
% CATEGORY: language/string
% 测试 string 的删除

function test_string_eraseBetween()
STR = "The quick brown fox"; START_PAT = 5; END_PAT = 9;
assert_istrue(eraseBetween(STR, START_PAT, END_PAT), "The  brown fox");

STR = ["The quick brown fox";"3 quick 5 fox"]; START_PAT = [3;2]; END_PAT = [5;4];
result = ["Thuick brown fox"
    "3ick 5 fox"];
assert_istrue(eraseBetween(STR, START_PAT, END_PAT), result);

STR = ["The quick brown fox";"a quick b fox"]; START_PAT = ["quick";"3"]; END_PAT = ["fox";"5"];
result = ["The quickfox"
    "a quick b fox"];
assert_istrue(eraseBetween(STR, START_PAT, END_PAT), result);

STR = "The quick brown fox"; START_PAT = "quick"; END_PAT = "fox";
result = "The quickfox";
assert_istrue(eraseBetween(STR, START_PAT, END_PAT), result);

STR = ["The quick brown fox";"a quick b fox"]; START_PAT = ["quick";"a"]; END_PAT = ["fox";"b"];
result = ["The quickfox"
    "ab fox"];
assert_istrue(eraseBetween(STR, START_PAT, END_PAT), result);

STR = ["The quick brown fox";"a quick b fox"]; START_PAT = ["quick";"a"]; END_PAT = ["fox";"b"];
result = ["The "
    " fox"];
assert_istrue(eraseBetween(STR, START_PAT, END_PAT, "Boundaries", "inclusive"), result);

STR = ["The quick brown fox";"a quick b fox"]; START_PAT = [1;3]; END_PAT = [3;5];
result = ["Te quick brown fox"
    "a qick b fox"];
eraseBetween(STR, START_PAT, END_PAT, 'Boundaries', 'exclusive');
assert_istrue(eraseBetween(STR, START_PAT, END_PAT, 'Boundaries', 'exclusive'), result);

end
function assert_istrue(x, y)
    assert(x == y);
end